local SceneManager = class("SceneManager")
local sceneMgr = CS.SceneMgr.Instance

function SceneManager:loadScene(sceneId)
    self._sceneId = sceneId
    local scene = require("config.scene").get(sceneId)
    G_ObjectPoolManager:clearObjetcPool()
    sceneMgr:LoadScene(scene.name)
    CS.System.GC.Collect() -- 清理内存
end

function SceneManager:loadSceneAnsc(sceneId)
    self._sceneId = sceneId
    local scene = require("config.scene").get(sceneId)
    local isDone = false
    G_ObjectPoolManager:clearObjetcPool()
    sceneMgr:LoadSceneAnsc(
        scene.name,
        function()
            isDone = true
        end
    )
    local popup = require("view.load.PopupLoadView").new()
    G_Corutine.start(
        function()
            while isDone == false do
                coroutine.yield(nil)
            end
            popup:close()
            CS.System.GC.Collect() -- 清理内存
        end
    )
end

function SceneManager:getCurSceneId()
    return self._sceneId
end

return SceneManager
